import requests


class IHRMDepartmen:
    #封装添加部门方法
    @classmethod
    def add_depart(cls,token,body):
        url ='http://ihrm2-test.itheima.net/api/company/department'
        header ={"Content-Type":"application/json","Authorization":token}
        resp =requests.post(url=url,headers=header,json=body)
        return resp
    #封装查询部门方法
    @classmethod
    def query_depart(cls,depart_id,token):
        url = "http://ihrm2-test.itheima.net/api/company/department/"+depart_id
        header = {"Authorization": token}
        resp = requests.get(url=url, headers=header)
        return resp
    #封装修改部门方法
    @classmethod
    def modify_depart(cls,depart_id,token,body):
        url ="http://ihrm2-test.itheima.net/api/company/department/"+depart_id
        header ={"Content-Type":"application/json","Authorization":token}
        resp =requests.put(url=url,headers=header,json=body)
        return resp
    #封装删除部门方法
    @classmethod
    def delete_department(cls,depart_id,token):
        url = "http://ihrm2-test.itheima.net/api/company/department/"+depart_id
        header = {"Authorization": token}
        resp =requests.delete(url=url, headers=header)
        return resp